import Mock from 'mockjs'

const domain = '/api/'

// 模拟login接口
Mock.mock(domain + 'login', function (data) {
    let result = {
        code: 200,
        message: 'OK',
        data: {
            loginUid: 10000,
            nickname: JSON.parse(data.body).account,
            token: 'yyds2023',
        },
    }
    return result
})

Mock.mock(domain + 'getUserList', function () {
  let result = {
    code: 200,
    message: 'OK',
    data: [
      {
        key: 1,
        loginUid: 10000,
        nickname: 'Ces',
        age: 18,
        token: 'yyds2023',
      },
      {
        key: 2,
        loginUid: 10001,
        nickname: 'Test',
        age: 19,
        token: 'yyds2025',
      },
    ],
  }
  return result
})

Mock.mock(domain + 'getMenuList', function () {
  let result = {
    code: 200,
    message: 'OK',
    data: [
      {
        name: '用户管理',
        path: '/users'
      },
      {
        name: '用户详情',
        path: '/users/details'
      }
    ]
  }
  return result
})
